Skip to content

build: add clang ci#214

Open
egolearner wants to merge 9 commits intomainfrom
add-clang-ci
Open

build: add clang ci#214
egolearner wants to merge 9 commits intomainfrom
add-clang-ci

Conversation

@egolearner
Copy link
Collaborator

@egolearner egolearner commented Mar 11, 2026

Greptile Summary

This PR adds a new Clang CI job for linux-x64 by extending the existing reusable workflow (03-macos-linux-build.yml) with an optional compiler input (defaulting to gcc) and wiring up a new build-and-test-linux-x64-clang job in the pipeline orchestrator.

Key changes:

  • New compiler workflow input (gcc | clang) with a default of gcc, keeping all existing callers unaffected.
  • Conditional apt-get install clang step and CC/CXX environment variable injection when compiler == 'clang'.
  • A diagnostic lscpu step added for all Linux runners.
  • New build-and-test-linux-x64-clang job in 01-ci-pipeline.yml targeting ubuntu-24.04.

Issue found:

  • The Install Clang step conditions only on inputs.compiler == 'clang' without also checking runner.os == 'Linux'. Because apt-get does not exist on macOS and macOS runners already include Apple Clang, the step would fail if this workflow is ever invoked with compiler: clang against a macOS runner. The immediately following Print CPU info step correctly uses runner.os == 'Linux' as a guard.

Confidence Score: 4/5

  • Safe to merge for the current use-case (Linux-only Clang job), but contains a latent bug that could break macOS builds if the reusable workflow is later called with compiler: clang on a macOS runner.
  • The changes are small, well-scoped, and the new job only targets ubuntu-24.04, so there is no immediate breakage. However, the missing runner.os == 'Linux' guard on the Install Clang step is a real forward-compatibility issue that is trivial to fix now before it causes a hard failure later.
  • 03-macos-linux-build.yml — the Install Clang step needs an additional OS guard.

Important Files Changed

Filename Overview
.github/workflows/01-ci-pipeline.yml Adds a new build-and-test-linux-x64-clang CI job that reuses the existing reusable workflow with compiler: clang and os: ubuntu-24.04. Change is straightforward and correct.
.github/workflows/03-macos-linux-build.yml Adds compiler input, an apt-based Clang install step, CPU info logging, and CC/CXX env-var injection. The Clang install step is missing an runner.os == 'Linux' guard, which would cause failures if the workflow is ever called with compiler: clang on a macOS runner.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[01-ci-pipeline.yml\nMain Workflow Trigger] --> B[lint job]
    B --> C[build-and-test-macos-arm64\ncompiler: gcc default]
    B --> D[build-and-test-linux-arm64\ncompiler: gcc default]
    B --> E[build-and-test-linux-x64\ncompiler: gcc default]
    B --> F[build-and-test-linux-x64-clang\ncompiler: clang ⭐ NEW]
    B --> G[build-android]

    C --> H[03-macos-linux-build.yml]
    D --> H
    E --> H
    F --> H

    H --> I{inputs.compiler == 'clang'}
    I -- Yes --> J[apt-get install clang\n⚠️ no runner.os guard]
    I -- No --> K[skip install]
    J --> L[Set CC=clang CXX=clang++]
    K --> M[CC/CXX unchanged]
    L --> N[Build & Test]
    M --> N
Loading

Last reviewed commit: "add clang ci"

Greptile also left 1 inline comment on this PR.

@egolearner
Copy link
Collaborator Author

@greptile

richyreachy
richyreachy previously approved these changes Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants